package kr.co.exight.onApp;
import library.ExPreferenceManager;
import library.Library;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.ToggleButton;


public class DialogNotice extends ParentDialog{

	String url;
	Bitmap bitmapCoupon;
	ImageView ivCoupon;
	TextView tvText1 , tvText2, tvText3, tvText4, tvText5;
	ProgressBar pb;
	public DialogNotice(Activity activity, final Boolean isOnCard) {
		super(activity);
		
		final ExPreferenceManager a = new ExPreferenceManager(activity.getParent());

		final Dialog dialog = getDialog();
		if(isOnCard){
			dialog.setContentView(R.layout.dialog_notice);
		}else {
			dialog.setContentView(R.layout.dialog_notice_time);
		}


		tvText1 = (TextView)dialog.findViewById(R.id.popCard_tvText1);
		tvText2 = (TextView)dialog.findViewById(R.id.popCard_tvText2);
		tvText3 = (TextView)dialog.findViewById(R.id.popCard_tvText3);
		tvText4 = (TextView)dialog.findViewById(R.id.popCard_tvText4);
		tvText5 = (TextView)dialog.findViewById(R.id.popCard_tvText5);


		final ToggleButton tb = (ToggleButton)dialog.findViewById(R.id.popCard_tb);
		Button ivExit = (Button)dialog.findViewById(R.id.popCard_ivExit);

		ivExit.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			}
		});


		tb.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(tb.isChecked()){
					if(isOnCard){
						a.putItem(ExPreferenceManager.TAG_ONCARD_FIRST, "TRUE");
					}else {
						a.putItem(ExPreferenceManager.TAG_ONTIME_FIRST, "TRUE");
					}
				}else {
				
					if(isOnCard){
						a.putItem(ExPreferenceManager.TAG_ONCARD_FIRST, "");
					}else {
						a.putItem(ExPreferenceManager.TAG_ONTIME_FIRST, "");
					}
				}
			}
		});

		Library.setFontNanumGothic(tvText1);
		Library.setFontNanumGothic(tvText2);
		Library.setFontNanumGothic(tvText3);
		Library.setFontNanumGothic(tvText4);
		Library.setFontNanumGothic(tvText5);

		Library.setTextViewBold(tvText1);
		Library.setTextViewBold(tvText3);



		// TODO Auto-generated constructor stub
	}


	@Override
	public void showDialog() {
		// TODO Auto-generated method stub

		dialog.show();
	}
}